package com.nandi.deviceinstall.model

import com.nandi.deviceinstall.bean.*
import com.nandi.deviceinstall.contract.BindRecordContract
import com.nandi.deviceinstall.net.RetrofitClient
import io.reactivex.Flowable

class BindRecordModel : BindRecordContract.Model {
    override fun executeDeleteBindRecord(token: String, id: Int): Flowable<BindDeleteBean> {
        return apiService.deleteBindRecord(token, id)
    }

    override fun getListDevFactory(token: String,factory: String): Flowable<DeviceFacBean> {
        return apiService.listDevFactory(token,factory)
    }

    private val apiService = RetrofitClient.getInstance()!!.api!!

    override fun executeDisNum(token: String, disName: String, areaCode: String): Flowable<DisNumBean> {
        return apiService.getDisNum(token, disName, areaCode)
    }

    override fun getListDisaster(token: String, current: Int, size: Int, areaCode: String): Flowable<DisasterBean> {
        return apiService.listDisaster(token, areaCode)
}

    override fun getListCity(token: String, district: String): Flowable<CityBean> {
        return apiService.listCity(token, district)
    }

    override fun getListTown(token: String, id: Int): Flowable<TownBean> {
        return apiService.listTown(token, id)
    }

    override fun getListRecord(token: String, current: Int, size: Int, areaCode: String, sort: Int, townCode: String,
                               disasterName: String, disNo: String, monitorNo: String, startTime: String, endTime: String,
                               isAppAdd: Int, devType: Int, devName: String, devFactory: String): Flowable<BindRecordBean> {
        return apiService.listBindRecord(token, current, size, areaCode, sort, townCode,
                disasterName, disNo, monitorNo, startTime, endTime, isAppAdd, devType, devName, devFactory)
    }

    override fun getListMonitorNum(token: String, unifiedCode: String): Flowable<ListMonitorNumBean> {
        return apiService.listMonitorNum(token, unifiedCode)
    }

    override fun executeListDisName(token: String, disasterName: String, town: String): Flowable<DisNameBean> {
        return apiService.listDisName(token, disasterName, town)
    }

}